package com.company;

import java.io.*;
import java.util.AbstractList;
import java.util.ArrayDeque;
import java.util.ArrayList;

/**
 * Created by Administrator on 2016.7.27.
 */
public class Procedure {
    private Trie trie;
    private Select select;

    //默认地址构造方法，默认使用内部的词林
    public Procedure() throws FileNotFoundException {
        trie=new Trie("src/dictionary.txt");
        select=new Select();
    }

    //导入某个词林的构造方法
    public Procedure(String address)throws FileNotFoundException{
        trie=new Trie(address);
    }

    //给出两个词，计算出其最大
    public double maxSimilarity(String word1,String word2) {
        return Calculate.distance(word1,word2,trie,select);
    }

    //给出两个词，直接计算其词义是否完全相同：
    public int isEqual(String word1,String word2){
        if(Calculate.isSynonymy(word1,word2,select)){
            return 1;
        }

        return 0;
    }

}
